public class AdapterPattern {
    public static void main(String[] args) {
        EnglishPeople englishPeople=new Adapter();
        englishPeople.speakEnglish();
    }
}

class EnglishPeople {
    public void speakEnglish() {
        System.out.println("英语");
    }
}

class ChinesePeople {
    public void speakChinese() {
        System.out.println("中文");
    }
}
/* 
 * 继承了EnglishPeople类，拥有EnglishPeople类的一切
 * 重写speakEnglish，使其可以复用speakChinese方法
 * 
 * 这样以来，Adapter就是一个复用speakChinese方法的EnglishPeople子类
 */
class Adapter extends EnglishPeople{
    ChinesePeople chinesePeople=new ChinesePeople();
    @Override
    public void speakEnglish() {
        chinesePeople.speakChinese();
    }
}
